Add month lookup, used by PCX.
authorrobertl <robertl@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Thu, 11 Mar 2004 14:53:00 +0000 (14:53 +0000)
committerrobertl <robertl@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Thu, 11 Mar 2004 14:53:00 +0000 (14:53 +0000)
gpsbabel/util.c

index 8ac7d26c8d3327214074405a5552d4cc3764e113..a50d9825d52718deac3561d27155d6e66c39c882 100644 (file)
@@ -449,6 +449,21 @@ get_tz_offset(void)
        }
 }
 
+signed int
+month_lookup(const char *m)
+{
+       static const char *months[] = {
+               "JAN", "FEB", "MAR", "APR", "MAY", "JUN", 
+               "JUL", "AUG", "SEP", "OCT", "NOV", "DEC", NULL };
+       const char **mp;
+
+       for (mp = months; *mp; mp++) {
+               if (0 == case_ignore_strcmp(*mp, m))
+                       return mp - months;
+       }
+       return -1;
+}
+
 /*
  * Return a pointer to a constant string that is suitable for icon lookup
  * based on geocache attributes.   The strings used are those present in 
@@ -585,7 +600,6 @@ strsub(char *s, char *search, char *replace)
        strcat(d, p + slen);
        return d;
 }
-
                        
 void utf8_to_int( const char *cp, int *bytes, int *value ) 
 {